﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NS.Utilities;
using NS.BLL.Systems;
using Model;
using BLL;

public partial class Platform_PartnerModify : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataShow();
        }
    }
    private void DataShow()
    {
        Partner Model = PartnerService.GetPartnerById(int.Parse(Request.QueryString["ID"].ToString()));
        if (Model != null)
        {
            txtPartnerNo.Text = Model.PartnerNo;
            txtPartnerName.Text = Model.PartnerName;
            txtAddress.Text = Model.Address;
            txtLianXR.Text = Model.LianXR;
            txtLianXDH.Text = Model.LianXDH;
            txtNum.Text = Model.Num.ToString();
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Partner Model = PartnerService.GetPartnerById(int.Parse(Request.QueryString["ID"].ToString()));
        Model.PartnerName = txtPartnerName.Text.Trim();
        Model.Address = txtAddress.Text.Trim();
        Model.LianXR = txtLianXR.Text.Trim();
        Model.LianXDH = txtLianXDH.Text.Trim();
        Model.Num = int.Parse(txtNum.Text.Trim());
        if (PartnerService.UpdatePartnerById(Model) > 0)
        {
            MessageBox.AppendScript(this, "$(':input[id$=\"btnBindData\"]', window.parent.document.body).click();");
        }
        else
        {
            MessageBox.ShowSaveError(this);
        }
    }
}